package com.demo.edit.config;

import com.demo.edit.stream.LocalSteam;
import com.demo.edit.util.RedisRegister;
import com.saver.office.ISteam;
import com.saver.office.WebServletBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ServletConfig {



    @Bean
    public ISteam mySteam() {
        return new LocalSteam();
    }

    @Bean
    public ServletRegistrationBean office(ISteam mySteam, RedisRegister register) {
        WebServletBean officeServlet = new WebServletBean();
        ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(
                officeServlet, "/office");
        officeServlet.setSteamImp(mySteam);
        officeServlet.setRegister(register);
        servletRegistrationBean.setLoadOnStartup(1);
        return servletRegistrationBean;
    }

}
